home *** CD-ROM | disk | FTP | other *** search
- program DEMO;
-
- var
- ACTION_NO : byte;
- ERROR,
- SCREEN_NO : integer;
- OVER_LAY : boolean;
-
- procedure PAUSE;
-
- type REGISTER = record
- ax,bx,cx,dx,bp,si,ds,es,flags: integer;
- end;
- var
- INTRARGS : REGISTER;
-
- begin
- with INTRARGS do
- begin
- ax:=$0000;
- intr($16,INTRARGS);
- end;
- end;
-
- procedure SLOW_DOWN;
-
- var
- INT: integer;
-
- begin
- for INT := 0 to 10000 do
- end;
-
- {*****************************************************************************}
- { PROCEDURE FILLSCREEN }
- { }
- { This procedure reads images from disk files created using TURBO SCREENWORKS }
- { and displays the images on the monitor. Syntax for calling FILLSCREEN is: }
- { }
- { fillscreen(SCREEN_FILE,SCREEN_NUMBER,ACTION,OVER_LAY,ERROR) }
- { }
- { where }
- { SCREEN_NO = an integer expression containing the number }
- { of the screen you wish to display. }
- { ACTION = an integer expression that denotes the action}
- { that is to be taken. Actions taken either }
- { involve the actual DISPLAY memory (what you }
- { see on your monitor) or a storage array }
- { called V_DATA. Legal ACTIONS are: }
- { }
- { 1 = Read a new screen into both DISPLAY }
- { memory and V_DATA. }
- { 2 = Read a new screen into V_DATA only. }
- { This does not affect the DISPLAY memory. }
- { 3 = Read a new screen into DISPLAY memory }
- { only. This does not affect the screen }
- { data contained in V_DATA. }
- { 4 = Move the screen data from V_DATA to }
- { DISPLAY memory. }
- { 5 = Move the screen data from DISPLAY memory }
- { to V_DATA. }
- { }
- { OVER_LAY = a logical switch that when set to FALSE }
- { clears the previous screen data from either }
- { DISPLAY memory or V_DATA before loading the }
- { new data. If set to TRUE, the new data }
- { simply overlays the existing data. }
- { ERROR = an integer expression that is returned by }
- { FILLSCREEN as an indicator of the success of }
- { the operation. If ERROR = 0 then the oper- }
- { was successful. Any other return code indi- }
- { cates that an I/O error occurred. Consult }
- { your pascal manual for reference. }
- { NOTE: It is then programmers responsibilty }
- { to insure that the parameters passed are }
- { valid. }
- {*****************************************************************************}
-
- procedure FILLSCREEN(var SCRN_NO:integer;
- var ACTION:byte;
- var OVER_LAY:boolean;
- var IOERR:integer);
-
- type
- PD = record
- PB: array[1..6] of byte;
- FB: integer;
- end;
- var
- BUFFER: array[0..127] of byte;
- IF1,
- IF2 : string[12];
- J,
- J1,
- J2 : integer;
- PR : PD;
- PF : file of PD;
- SF : file;
- V_BASE: integer absolute $0000:$0463;
- V_DATA: array[0..4000] of byte;
- V_MODE: byte absolute $0000:$0465;
- V_SEG : integer;
- procedure V_ON;
- begin;
- port[V_BASE+4] := V_MODE;
- end;
- procedure V_OFF;
- begin;
- if V_SEG = $B800 then port[V_BASE+4] := V_MODE and $F7;
- end;
-
- label EXIT;
- begin
- V_SEG := $B800;
- if (mem[$0040:$0010] and 48) = 48 then V_SEG := $B000;
- if ACTION < 4 then
- begin
- {$I-} {**** YOU MAY WISH TO REMOVE THIS LINE ****}
- IF1 := 'DEMO.SDT';
- IF2 := 'DEMO.SDT';
- assign(PF,IF1);assign(SF,IF2);
- reset(PF);IOERR := IORESULT;
- if IOERR > 0 then goto EXIT;
- reset(SF);IOERR := IORESULT;
- if IOERR > 0 then goto EXIT;
- seek(PF,SCRN_NO);IOERR := IORESULT;
- if IOERR > 0 then goto EXIT;
- read(PF,PR);IOERR := IORESULT;
- if IOERR > 0 then goto EXIT;
- {$I+} {**** YOU MAY WISH TO REMOVE THIS LINE ****}
- if not OVER_LAY then
- case ACTION of
- 1,2: fillchar(V_DATA[0],4000,0);
- 1,3: begin;
- V_OFF;
- fillchar(mem[V_SEG:0],4000,0);
- V_ON;
- end;
- end;
- with PR do
- begin
- seek(SF,FB);J := 128;
- for J1 := PB[1] to PB[3] do
- begin
- for J2 := PB[2] to PB[4] do
- begin
- if J = 128 then
- begin
- blockread(SF,BUFFER,1);
- J := 0;
- end;
- if ACTION < 3 then move(BUFFER[J],V_DATA[((J1-1)*160)+((J2-1)*2)],2)
- else move(BUFFER[J],mem[V_SEG:((J1-1)*160)+((J2-1)*2)],2);
- J := J + 2;
- end;
- end;
- end;
- close(PF);
- close(SF);
- end;
- if (ACTION <> 2) and (ACTION <> 3) then
- begin
- V_OFF;
- if ACTION <> 5 then move(V_DATA[0],mem[V_SEG:0],4000)
- else move(mem[V_SEG:0],V_DATA[0],4000);
- V_ON;
- end;
- EXIT:
- end;
-
-
- {----------------------------------------------------------------------------}
- begin
-
- SCREEN_NO := 1; { The first screen in the file }
- ACTION_NO := 1; { Read into DISPLAY and V_DATA }
- OVER_LAY := false; { Don't overlay }
- ERROR := 0; { Initialize ERROR }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- PAUSE; { Let the operator press any key... }
-
- SCREEN_NO := 2; { The second screen in the file }
- ACTION_NO := 3; { Read into DISPLAY only }
- OVER_LAY := true; { Overlay the current screen }
- ERROR := 0; { Initialize ERROR }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- PAUSE; { Let the operator press any key... }
-
- SCREEN_NO := 3; { The third screen in the file }
- ACTION_NO := 3; { Read into DISPLAY only }
- OVER_LAY := true; { Overlay the current screen }
- ERROR := 0; { Initialize ERROR }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- PAUSE; { Let the operator press any key... }
-
- SCREEN_NO := 4; { The fourth screen in the file }
- ACTION_NO := 3; { Read into DISPLAY only }
- OVER_LAY := false; { Clear the display first }
- ERROR := 0; { Initialize ERROR }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- { While the operator is looking at }
- { the last screen, load the next }
- { screen into V_DATA }
- SCREEN_NO := 5; { The fifth screen in the file }
- ACTION_NO := 2; { Read into V_DATA only }
- OVER_LAY := true; { Overlay }
- ERROR := 0; { Initialize ERROR }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- PAUSE; { Let the operator press any key... }
-
- SCREEN_NO := 0; { Dummy assignment }
- ACTION_NO := 4; { Copy from V_DATA to DISPLAY }
- OVER_LAY := true; { Dummy assignment }
- ERROR := 0; { Dummy assignment }
-
- fillscreen(SCREEN_NO,ACTION_NO,OVER_LAY,ERROR);
-
- { Now move the screen (screen #5 }
- { overlayed onto screen #1) residing}
- { in V_DATA to DISPLAY. Note that }
- { the parameters SCN_FILE, SCRN_NO, }
- { OVERLAY and ERROR have no effect }
- { here. }
-
- window(17,9,61,14); { Set up a window. }
- textcolor(14);textbackground(0); { Set colors. }
- gotoxy(1,1); { Locate the cursor. }
- SLOW_DOWN;SLOW_DOWN; { Give the operator some time... }
- SLOW_DOWN;SLOW_DOWN;
- SLOW_DOWN;SLOW_DOWN;
- SLOW_DOWN;SLOW_DOWN;
- SLOW_DOWN;SLOW_DOWN; { ...and write to the window slowly.}
- writeln('And finally, we return to the very first ');SLOW_DOWN;SLOW_DOWN;
- writeln('screen in the demo. However, in this ex- ');SLOW_DOWN;SLOW_DOWN;
- writeln('ample, an additional screen was overlayed ');SLOW_DOWN;SLOW_DOWN;
- writeln('in the background and windowing features ');SLOW_DOWN;SLOW_DOWN;
- writeln('were added.');SLOW_DOWN;
- PAUSE;
- writeln;SLOW_DOWN;
- writeln;SLOW_DOWN;
- writeln;SLOW_DOWN;
- writeln;SLOW_DOWN;
- writeln(' TH-TH-TH-THAT',#39,'S ALL FOLKS!!!!!!!');SLOW_DOWN;
- writeln;SLOW_DOWN;
- writeln;SLOW_DOWN;
- PAUSE;
- window(1,1,80,25); { Reset the window coordinate. }
- gotoxy(1,1); { Relocate the cursor and exit. }
- clrscr;
- end.